package lz.controls.nick
{
	import com.greensock.TweenLite;
	
	import fl.transitions.easing.Elastic;

	public class TweenUtils
	{
		public static var _textVec:Vector.<TweenTextField>;
		public function TweenUtils()
		{
		}
		public static function show($str:String):void
		{
			var text:TweenTextField = getText($str);
			TweenLite.to(text,3,{alpha:1,y:100,onComplete:onFinishTween, onCompleteParams:[5, text],ease:Elastic.easeOut});
		}
		/**
		 * 
		 * @param $delay
		 * @param $displayobj
		 * 
		 */
		public static function onFinishTween($delay:int,$displayobj:TweenTextField):void
		{
			if($displayobj.parent)
				$displayobj.parent.removeChild($displayobj);
		}
		public static function getText($str:String):TweenTextField
		{
			if(_textVec == null)_textVec = new Vector.<TweenTextField>();
			var text:TweenTextField;
			if(_textVec.length > 0)
			{
				text = _textVec.pop();
				text.text = $str;
				return text ;
			}
			_textVec.push( new TweenTextField());
			return getText($str);
		}
	}
}